package com.Controller;

import com.Service.AddressService;
import com.Service.EngineerService;
import com.Utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/Address")
public class AddressController {
    @Autowired
    private AddressService addressService;

    @PostMapping("/findAddress")
    public R findTel(@RequestBody Map<String,String> Map_All){
        String tel=Map_All.get("tel");
        System.out.println(addressService.findAddress(tel));
        return new R(true,addressService.findAddress(tel));
    }
    @PostMapping("/addAddress")
    public R addAddress(@RequestBody Map<String,String> Map_All){
        return new R(true,addressService.addAddress(Map_All)>0);
    }
    @PostMapping("/delAddress")
    public R delAddress(@RequestBody Map<String,String> Map_All){
        int id= Integer.parseInt(Map_All.get("id"));
        return new R(true,addressService.delAddress(id)>0);
    }
}
